import { uploadFile, downFile } from "@/components/upload/utils/file.ts";

export const useInputRichMixins = {
  data: function() {
    return {
      downFile,
      imgUrls: {}
    };
  },
  methods: {
    uploadFn(fileType, file) {
      const formData = new FormData();
      formData.append("file", file);
      formData.append("bizPath", "approve/oo-csc-upp-approve-atom");
      formData.append("uploadType", "minio");
      return uploadFile(formData)
        .then(res => {
          const dataId = res.data.data.split(":")[0];
          return dataId;
        })
        .catch(e => {
          this.$message.error("上传失败，请联系开发人员");
          console.error(e);
        });
    },
    handleImg(val) {
      this.imgUrls = val;
    }
  }
};